<script setup>
import { ref } from 'vue'
import { Calendar, OfficeBuilding } from '@element-plus/icons-vue'

// 党建动态数据
const partyNews = ref([
    {
        id: 1,
        title: '实验室党支部开展主题党日活动',
        date: '2024-03-15',
        content: '为深入学习贯彻习近平新时代中国特色社会主义思想，进一步加强党支部建设，实验室党支部组织开展了主题党日活动...',
        image: 'path/to/image1.jpg'
    },
    // 添加更多新闻...
])

// 党支部成员数据
const partyMembers = ref([
    {
        id: 1,
        name: '张三',
        role: '支部书记',
        avatar: ''
    },
    // 添加更多成员...
])

// 党员风采数据
const partyShowcase = ref([
    {
        id: 1,
        name: '李四',
        title: '优秀党员',
        description: '在科研工作中勤勤恳恳，带领团队取得多项重要成果...',
        avatar: ''
    },
    // 添加更多党员风采...
])
</script>

<template>
    <div class="party-container">
        <div class="main-content">
            <!-- 页面标题 -->
            <div class="page-header">
                <h1>党建工作</h1>
            </div>

            <!-- 党建内容区域 -->
            <div class="party-content">
                <!-- 党建动态 -->
                <div class="section party-news">
                    <div class="section-header">
                        <h2>党建动态</h2>
                    </div>
                    <div class="news-list">
                        <el-card v-for="news in partyNews" :key="news.id" class="news-item">
                            <div class="news-content">
                                <h3 class="news-title">{{ news.title }}</h3>
                                <div class="news-info">
                                    <span class="news-date">
                                        <el-icon><Calendar /></el-icon>
                                        {{ news.date }}
                                    </span>
                                </div>
                                <p class="news-summary">{{ news.content }}</p>
                                <div class="news-image" v-if="news.image">
                                    <el-image :src="news.image" fit="cover" />
                                </div>
                            </div>
                        </el-card>
                    </div>
                </div>

                <!-- 组织架构 -->
                <div class="section party-structure">
                    <div class="section-header">
                        <h2>组织架构</h2>
                    </div>
                    <el-card class="structure-content">
                        <div class="structure-tree">
                            <div class="branch-item">
                                <div class="branch-header">
                                    <el-icon><OfficeBuilding /></el-icon>
                                    <span>智慧农业实验室党支部</span>
                                </div>
                                <div class="branch-members">
                                    <div class="member-item" v-for="member in partyMembers" :key="member.id">
                                        <el-avatar :size="60" :src="member.avatar">
                                            {{ member.name.charAt(0) }}
                                        </el-avatar>
                                        <div class="member-info">
                                            <div class="member-name">{{ member.name }}</div>
                                            <div class="member-role">{{ member.role }}</div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </el-card>
                </div>

                <!-- 党员风采 -->
                <div class="section party-showcase">
                    <div class="section-header">
                        <h2>党员风采</h2>
                    </div>
                    <div class="showcase-grid">
                        <el-card v-for="member in partyShowcase" :key="member.id" class="showcase-item">
                            <div class="showcase-content">
                                <el-avatar :size="80" :src="member.avatar">
                                    {{ member.name.charAt(0) }}
                                </el-avatar>
                                <h3>{{ member.name }}</h3>
                                <p class="member-title">{{ member.title }}</p>
                                <p class="member-description">{{ member.description }}</p>
                            </div>
                        </el-card>
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>



<style lang="scss" scoped>
.party-container {
    .main-content {
        max-width: 1400px;
        margin: 0 auto;
        padding: 40px 20px;
    }

    .page-header {
        margin-bottom: 40px;
        text-align: center;

        h1 {
            font-size: 36px;
            color: #D32F2F;
            margin: 0;
            position: relative;
            display: inline-block;
            padding-bottom: 15px;

            &::after {
                content: '';
                position: absolute;
                bottom: 0;
                left: 50%;
                transform: translateX(-50%);
                width: 60px;
                height: 4px;
                background-color: #D32F2F;
            }
        }
    }

    .section {
        margin-bottom: 50px;

        .section-header {
            margin-bottom: 30px;
            border-bottom: 2px solid #D32F2F;
            padding-bottom: 10px;

            h2 {
                font-size: 24px;
                color: #333;
                margin: 0;
                position: relative;
                padding-left: 15px;

                &::before {
                    content: '';
                    position: absolute;
                    left: 0;
                    top: 50%;
                    transform: translateY(-50%);
                    width: 4px;
                    height: 20px;
                    background-color: #D32F2F;
                }
            }
        }
    }

    .news-list {
        .news-item {
            margin-bottom: 20px;

            .news-content {
                .news-title {
                    font-size: 18px;
                    color: #333;
                    margin-bottom: 10px;
                }

                .news-info {
                    color: #666;
                    margin-bottom: 10px;
                    font-size: 14px;
                    display: flex;
                    align-items: center;
                    gap: 5px;
                }

                .news-summary {
                    color: #666;
                    line-height: 1.6;
                }

                .news-image {
                    margin-top: 15px;
                    
                    .el-image {
                        width: 100%;
                        height: 200px;
                        border-radius: 4px;
                    }
                }
            }
        }
    }

    .structure-content {
        .branch-item {
            .branch-header {
                display: flex;
                align-items: center;
                gap: 10px;
                font-size: 18px;
                color: #D32F2F;
                margin-bottom: 20px;
            }

            .branch-members {
                display: grid;
                grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
                gap: 20px;

                .member-item {
                    display: flex;
                    align-items: center;
                    gap: 15px;
                    padding: 15px;
                    border: 1px solid #eee;
                    border-radius: 8px;

                    .member-info {
                        .member-name {
                            font-size: 16px;
                            color: #333;
                            margin-bottom: 5px;
                        }

                        .member-role {
                            font-size: 14px;
                            color: #666;
                        }
                    }
                }
            }
        }
    }

    .showcase-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 20px;

        .showcase-item {
            text-align: center;
            padding: 20px;

            .showcase-content {
                .el-avatar {
                    margin-bottom: 15px;
                }

                h3 {
                    margin: 0 0 10px;
                    color: #333;
                }

                .member-title {
                    color: #D32F2F;
                    margin-bottom: 10px;
                }

                .member-description {
                    color: #666;
                    font-size: 14px;
                    line-height: 1.6;
                }
            }
        }
    }
}

// 响应式布局
@media (max-width: 768px) {
    .page-header h1 {
        font-size: 28px !important;
    }

    .branch-members {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)) !important;
    }

    .showcase-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)) !important;
    }
}
</style>